<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>try/catch/finally</title>
</head>

<body>


  <script>
    // function square(x) {
    //   if (x > 0) throw new Error('报错啦！')
    //   return x * x

    // }

    // try {
    //   let n = Number(prompt('请输入数值', ''))
    //   let f = square(n)
    //   alert(f)
    // } catch (ex) {
    //   console.log(ex);
    //   alert(ex)
    // }
  </script>
</body>

</html>